import http from './http/index';

export function apiAddDispatch(data: any) {
  return http({
    method: 'POST',
    url: '/api/dispatch/task/create',
    data,
  });
}

export function apiAddFastDispatch(data: any) {
  return http({
    method: 'POST',
    url: '/api/dispatch/task/dispatch/urgent',
    data,
  });
}

export function apiGetDispatchPage(data: any) {
  return http({
    method: 'POST',
    url: '/api/dispatch/task/page',
    data,
  });
}

export function apiGetDispatchDetail(data: any) {
  return http({
    method: 'GET',
    url: `/api/dispatch/task/get/${data.id}`,
  });
}

export function apiGetOrderDetail(data: any) {
  return http({
    method: 'GET',
    url: `/api/mobile/driver/order/details/${data.id}`,
  });
}

export function apiDispatchApprove(data: any) {
  return http({
    method: 'POST',
    url: `/api/dispatch/task/approve?id=${data.id}`,
    data,
  });
}

export function apiDispatchStart(data: any) {
  return http({
    method: 'POST',
    url: '/api/dispatch/task/dispatch',
    data,
  });
}

export function apiDriverTaskPage(data: any) {
  return http({
    method: 'POST',
    url: '/api/driver/task/pageForDriver',
    data,
  });
}

export function apiTaskallPage(data: any) {
  return http({
    method: 'POST',
    url: '/api/dispatch/taskall/page',
    data,
  });
}

export function apiCacleTask(data: any) {
  return http({
    method: 'GET',
    url: `/api/dispatch/task/dispatch/${data.id}`,
    params: data,
  });
}

export function apiChangeMil(data: any) {
  return http({
    method: 'POST',
    url: '/api/dispatch/task/updateMileage',
    data,
  });
}

export function apiGetWillMil(data: any) {
  return http({
    method: 'POST',
    url: '/api/dispatch/task/expected_mileage',
    data,
  });
}

export function apiGetDriverApplyPage(data: any) {
  return http({
    method: 'POST',
    url: '/api/mobile/driver/application/list',
    data,
  });
}

export function apiGetDriverTaskPage(data: any) {
  return http({
    method: 'POST',
    url: '/api/mobile/driver/waybill/order',
    data,
  });
}

export function apiGetDriverApplyDetail(data: any) {
  return http({
    method: 'GET',
    url: `/api/mobile/driver/order/details/${data.order_id}`,
  });
}

export function apiGetDispachHome(data: any) {
  return http({
    method: 'GET',
    url: `/api/mobile/driver/order/details/${data.order_id}`,
  });
}

export function apiGetDipatchTaskPage(data: any) {
  return http({
    method: 'POST',
    url: '/api/mobile/dispatcher/order/manage/list',
    data,
  });
}

export function apiGetBillPage(data: any) {
  return http({
    method: 'POST',
    url: '/api/mobile/dispatcher/order/bill/list',
    data,
  });
}

export function apiGetNoticePage(data: any) {
  return http({
    method: 'POST',
    url: 'api/mobile/message/notifications/filter',
    data,
  });
}

export function apiSetNoticeState(id: string) {
  return http({
    method: 'GET',
    url: `api/mobile/message/notifications/read/${id}`,
  });
}

export function apiGetCarAndDriver(phone: string) {
  return http({
    method: 'GET',
    url: `api/driverManage/driver/info/${phone}`,
  });
}
